fix(vite): resolve tsconfig paths in CSS and JS resolvers#19803
fix(vite): resolve tsconfig paths in CSS and JS resolvers#19803RobinMalfait merged 4 commits intotailwindlabs:mainfrom
Conversation
Change `aliasOnly` from `true` to `false` when calling Vite's resolver so that the full resolution pipeline runs, including the oxc resolver responsible for tsconfig path resolution. When `aliasOnly` was `true`, only the @rollup/plugin-alias plugin ran, which meant `resolve.tsconfigPaths: true` had no effect on CSS `@import` or JS `@plugin` resolution in `@tailwindcss/vite`. Closes tailwindlabs#19802
|
Caution Review failedPull request was closed or merged during review WalkthroughThe PR adds an import for 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
integrations/vite/resolvers.test.ts (1)
15-165: Optional: extract shared fixture setup to reduce duplication.Both new tests repeat the same filesystem fixture; extracting a small helper/object for shared files would make future resolver test updates less error-prone.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@integrations/vite/resolvers.test.ts` around lines 15 - 165, Extract the duplicated filesystem fixture used in the two tests titled "resolves tsconfig paths in production build" and "resolves tsconfig paths in dev mode" into a shared constant (e.g., sharedFs) and reference that constant in each test's options instead of duplicating the object; update the tests to pass the sharedFs to the test helper (replace the inline fs: { ... } blocks with fs: sharedFs) so future changes to the fixture live in one place and both tests (production build and dev mode) reuse the same setup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@integrations/vite/resolvers.test.ts`:
- Around line 15-165: Extract the duplicated filesystem fixture used in the two
tests titled "resolves tsconfig paths in production build" and "resolves
tsconfig paths in dev mode" into a shared constant (e.g., sharedFs) and
reference that constant in each test's options instead of duplicating the
object; update the tests to pass the sharedFs to the test helper (replace the
inline fs: { ... } blocks with fs: sharedFs) so future changes to the fixture
live in one place and both tests (production build and dev mode) reuse the same
setup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a1c6b6ce-a66b-41d5-a9dd-78be04245a20
📒 Files selected for processing (2)
integrations/vite/resolvers.test.tspackages/@tailwindcss-vite/src/index.ts
|
Hey! Looks like CI is failing. Do you mind making sure that things work as expected? Thanks! |
|
Thanks for the ping @RobinMalfait. I believe this is now fixed. When That said, I'm unsure whether the remaining test failures are related to my change or an environmental issue.
|
RobinMalfait
left a comment
There was a problem hiding this comment.
Running all the integration tests locally can result in issues when ports are already occupied. In CI, we split them so that doesn't happen. What I typically do locally is only run a single integration test at a time (typically the one I'm working on).
Since they pass in CI, I wouldn't worry about them locally 👍
Thanks for the contribution!
Change
aliasOnlyfromtruetofalsewhen calling Vite's resolver so that the full resolution pipeline runs, including the oxc resolver responsible for tsconfig path resolution.When
aliasOnlywastrue, only the @rollup/plugin-alias plugin ran, which meantresolve.tsconfigPaths: truehad no effect on CSS@importor JS@pluginresolution in@tailwindcss/vite.Closes #19802.